function s=shadow(xa,ya,xb,yb,D,t,x,y)
%计算两面镜子之间的阴影

%已知数据
% alpha_s=alp_s(D,t);%太阳高度角
% gama_s=ga_s(D,t);%太阳方位角
% sun_in=[cos(alpha_s)*cos(gama_s) cos(alpha_s)*sin(gama_s) sin(alpha_s)];%太阳入射光线的方向余弦在地面坐标系
% O_A=[xa ya 4];%镜子坐标系原点在地面坐标系的位置
% O_B=[xb yb 4];

%左上
x1_1=-3;
y1_1=3;
[x2_1,y2_1] = axis_change(xa,ya,xb,yb,D,t,x1_1,y1_1,x,y);
%左下
x1_2=-3;
y1_2=-3;
[x2_2,y2_2] = axis_change(xa,ya,xb,yb,D,t,x1_2,y1_2,x,y);
%右下
x1_3=3;
y1_3=-3;
[x2_3,y2_3] = axis_change(xa,ya,xb,yb,D,t,x1_3,y1_3,x,y);
%右上
x1_4=3;
y1_4=3;
[x2_4,y2_4] = axis_change(xa,ya,xb,yb,D,t,x1_4,y1_4,x,y);


   
%镜面坐标面积
locx1=[x1_1 x1_2 x1_3 x1_4];
locy1=[y1_1 y1_2 y1_3 y1_4];
poly1 = polyshape(locx1,locy1);

%阴影面积
locx2=[x2_1 x2_2 x2_3 x2_4];
locy2=[y2_1 y2_2 y2_3 y2_4];
poly2 = polyshape(locx2,locy2);
%figure 
%hold on;
%plot(poly1);
%plot(poly2);
polyout = intersect (poly1,poly2);%返回一个重叠多面体面积
%plot(polyout);
s=area(polyout);
end

